pub fn test_loop() {
    let mut counter = 0;

    let result = loop {
        counter += 1;
        if counter == 10 {
            break counter * 2;
        }
    };

    println!("The result is {result}");
}

pub fn test_for() {
    let a = [10, 20, 30, 40, 50];

    for element in a.iter() {
        println!("The value is: {element}");
    }
}

pub fn test_for2() {
    for number in (1..4).rev() {
        println!("{number}!");
    }
    println!("LIFTOFF!!!");

    println!();
    println!("(1..=4)");
    for number in 1..=4 {
        print!("{number}!\t");
    }
    println!();
}

pub fn test_string() {
    let mut s = String::from("hello");
    s.push_str(", world!");

    let len = s.len();
    println!("s.len() => {len}");

    let cap = s.capacity();
    println!("s.capacity() => {cap}");

    println!("{s}");
}
